package com.xiang.thread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class ThreadPoolUtil {

  public static ExecutorService executorService = new MyThreadPoolExecutor(2,//线程池大小(初始)
      5, //默认最大线程50
      10, //空闲线程保持时间
      TimeUnit.SECONDS,//单位秒
      new LinkedBlockingDeque<>(20),//，等待队列大小
      new ThreadPoolExecutor.DiscardOldestPolicy());//拒绝策略：丢弃队列最前面的任务，然后再添加任务


}
